import { ManListenCall } from 'seats/schema/Task';
import React from 'react';
import './style.scss';
import { Empty } from 'antd';
import { getStateDom, getStatusName } from 'admin/pages/Task/components/TaskTool';
/**
 * 坐席端-独有的方法
 */
/**
 * 坐席端-任务异常状态-节点渲染
 */
function renderExceptionDom(callInfo: ManListenCall, seatRest: 'on' | 'off') {
  return (
    <>
      {/* 任务执行中，坐席小休中  */}
      {callInfo.eventType === 'process' && seatRest === 'on' && (
        <div className="box-empty body-empty">
          <Empty
            image="/webseats/rest.png"
            description={<span>休息中，如需继续处理任务，请点击恢复</span>}
          />
        </div>
      )}
      {/* 任务中途被暂停 */}
      {callInfo.eventType === 'paused' && (
        <div className="box-empty body-empty">
          <Empty image="/webseats/paused.png" description={<span>任务已暂停</span>} />
        </div>
      )}
      {/* 任务到达禁呼时间 */}
      {callInfo.eventType === 'forbid' && (
        <div className="box-empty body-empty">
          <Empty image="/webseats/forbid.png" description={<span>已到禁呼时间</span>} />
        </div>
      )}
      {/* 任务未开始，任务执行中(非小休)，任务启动，任务已完成，任务过期*/}
      {(!callInfo.eventType ||
        (callInfo.eventType === 'process' && seatRest !== 'on') ||
        callInfo.eventType === 'start' ||
        callInfo.eventType === 'end' ||
        callInfo.eventType === 'expired') && (
        <div className="box-empty body-empty">
          <Empty image="/webseats/calling.png" description={<span>正在接入，请稍候</span>} />
        </div>
      )}
    </>
  );
}

export { getStatusName, getStateDom, renderExceptionDom };
